/**
 * 
 */
package com.googlecode.xcarve.netty.server;

import com.googlecode.xcarve.object.RPCRequest;

/**
 * @author xinyun.d
 * 2014年10月1日
 * @param <T>
 */
public abstract class AbstractServiceProxy<T> implements ServiceProxy{
	
	private T service;
	
	public AbstractServiceProxy(T proxy){
		this.service = proxy;
	}
	
	public Object invoke(RPCRequest request) throws Throwable{
		return doInvoke(service, request.getMethodName(), request.getParameterTypes(), request.getArguments());
	}
	
	abstract Object doInvoke(T service,String methodName,Class<?>[] paramTypes,Object[] paramValues)  throws Throwable;
	
}
